package com.guqinghan.guqinghan_05_broadcastreceiver_1;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class AppInstallReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i("jq","程序安装卸载广播");
        // 安装和卸载都会在这里
        String action = intent.getAction();
        switch (action){
            // 安装
            case Intent.ACTION_PACKAGE_ADDED:
                Log.i("jq","程序安装");
                break;
                // 卸载
            case Intent.ACTION_PACKAGE_REMOVED:
                Log.i("jq","程序卸载");
                break;
        }

    }
}
